import 'package:flutter/material.dart';
import '../../components/appbar.dart';
import '../../config/colors.dart';
import './tabs/subject1.dart';
import './tabs/subject2.dart';
import './tabs/subject3.dart';
import './tabs/subject4.dart';

class ExamPage extends StatefulWidget {
  @override
  _ExamPageState createState() => _ExamPageState();
}

class _ExamPageState extends State<ExamPage> with SingleTickerProviderStateMixin {
  final List<Tab> subjectTabs = <Tab>[
    Tab(text: '科目一'),
    Tab(text: '科目二'),
    Tab(text: '科目三'),
    Tab(text: '科目四')
  ];

  TabController _tabController;

  @override
  void initState() { 
    super.initState();
    _tabController = TabController(vsync: this, length: subjectTabs.length);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBarWithCities(
        title: '乐驾学车',
        height: 50,
        tabHeight: 30.0,
        tabs: TabBar(
          controller: _tabController,
          labelStyle: TextStyle(fontSize: 12.0),
          labelColor: Color(AppColors.assistBlue),
          unselectedLabelColor: Color(AppColors.grayColor99),
          indicatorColor: Color(AppColors.assistBlue),
          indicatorSize: TabBarIndicatorSize.label,
          tabs: subjectTabs,
        ),
      ),
      body: TabBarView(
        controller: _tabController,
        physics: ScrollPhysics(),
        children: <Widget>[
          Subject1(),
          Subject2(),
          Subject3(),
          Subject4()
        ],
      ),
    );
  }
}